<template>
	<div class="personnelList Adjustment">
		<el-breadcrumb separator="/">
			<el-breadcrumb-item :to="{ path: '/' }"><i class="lh lh-diaodu fw_100"></i></el-breadcrumb-item>
			<el-breadcrumb-item>调度中心</el-breadcrumb-item>
			<el-breadcrumb-item>任务列表</el-breadcrumb-item>
		</el-breadcrumb>
		<div class="content_Box box-shadow abnormal mt_15">
			<div class="py_5 px_10">
				<el-row>
					<el-col :span="4">
						<el-button type="success" @click="addMenuBtnQYALL()" round size="mini">批量取消</el-button>
						<el-button type="default" @click="downloadOrder()" round size="mini">导出</el-button>
					</el-col>
					<el-col :span="20">
						<el-form :inline="true" :model="ruleForm" class="form-inline fr" @keyup.enter.native="shearchBtn()">
							<el-form-item>
								<el-input v-model="task_sn" placeholder="任务编号"></el-input>
							</el-form-item>
							<el-form-item>
								<el-input v-model="demand_sn" placeholder="订单编号"></el-input>
							</el-form-item>
							<el-form-item>
								<el-input v-model="staff_name" placeholder="接单人" class="w_80"></el-input>
							</el-form-item>
							<el-form-item>
								<el-input v-model="mobile" placeholder="手机号" class="w_110"></el-input>
							</el-form-item>
							<el-form-item>
								<el-autocomplete
									size="mini"
									class="w_130"
									v-model="shop_name"
									:fetch-suggestions="querySearch"
									placeholder="请选择店铺名称"
									:trigger-on-focus="true"
									@select="handleSelect"
								></el-autocomplete>
							</el-form-item>
							<!-- 代理商 -->
							<lh-agent-list @sendValue="setValue" :reset="agent_reset"></lh-agent-list>

							<el-form-item>
								<el-select class="w_100" v-model="city_val" placeholder="城市" @change="changeCity">
									<el-option
										v-for="item in cityList"
										:key="item.id"
										:label="item.name"
										:value="`${item.id}|${item.name}`"
									></el-option>
								</el-select>
							</el-form-item>
							<el-form-item>
								<el-select v-model="area_arr" multiple collapse-tags placeholder="商圈">
									<el-button
										size="mini"
										type="primary"
										class="round-right all-area"
										@click="selectAllArea()"
										native-type="button"
										>{{ areaStatus ? '全选' : '取消全选' }}</el-button
									>
									<el-option
										v-for="item in areaList"
										:key="item.id"
										:label="item.area_name"
										:value="`${item.id}|${item.area_name}`"
									></el-option>
								</el-select>
							</el-form-item>
							<el-form-item>
								<el-select size="mini" class="w_100" v-model="flow_path" placeholder="订单类型" clearable>
									<el-option label="平台调度" value="1"></el-option>
									<el-option label="商户调度" value="2"></el-option>
								</el-select>
							</el-form-item>

							<el-form-item class="mt">
								<el-cascader
									v-model="type_arr"
									:options="TypeArr"
									:props="optionProps"
									placeholder="请选择岗位"
									clearable
									@change="changeBtndialogtype"
								></el-cascader>
							</el-form-item>
							<el-form-item class="reset-el-select-tags">
								<el-select v-model="status" placeholder="请选择状态" multiple collapse-tags clearable>
									<el-option label="待分配" value="10"></el-option>
									<el-option label="待下发" value="15"></el-option>
									<el-option label="已下发" value="20"></el-option>
									<el-option label="已确认" value="30"></el-option>
									<el-option label="已签到" value="40"></el-option>
									<el-option label="已完成" value="50"></el-option>
									<el-option label="已撤回" value="60"></el-option>
									<el-option label="已取消" value="70"></el-option>
								</el-select>
							</el-form-item>
							<el-form-item class="w_90">
								<el-select v-model="work_type" clearable placeholder="人才类型">
									<el-option label="兼职" value="1"></el-option>
									<el-option label="全职" value="2"></el-option>
								</el-select>
							</el-form-item>
							<el-form-item class="w_90">
								<el-select v-model="pay_status" clearable placeholder="支付状态">
									<el-option label="已支付" value="1"></el-option>
									<el-option label="已退款" value="2"></el-option>
								</el-select>
							</el-form-item>
							<el-form-item class="w_90">
								<el-select v-model="is_prepay" clearable placeholder="支付类型">
									<el-option label="预付" value="1"></el-option>
									<el-option label="结算单结算" value="2"></el-option>
								</el-select>
							</el-form-item>
							<el-form-item>
								<el-select
									v-model="shop_settlement_status"
									placeholder="店铺结算状态"
									clearable
									class="shop_status w_120"
								>
									<!-- <el-option label="店铺结算状态" value=""></el-option> -->
									<el-option label="未入结算单" value="0"></el-option>
									<el-option label="已入结算单" value="10"></el-option>
									<el-option label="待付款" value="20"></el-option>
									<el-option label="已付款" value="30"></el-option>
								</el-select>
							</el-form-item>
							<el-form-item>
								<el-select
									v-model="staff_settlement_status"
									placeholder="人才结算状态"
									clearable
									class="staff_status w_120"
								>
									<!-- <el-option label="人才结算状态" value=""></el-option> -->
									<el-option label="未入结算单" value="0"></el-option>
									<el-option label="已入结算单" value="10"></el-option>
									<el-option label="待提现" value="20"></el-option>
									<el-option label="已提现" value="30"></el-option>
								</el-select>
							</el-form-item>
							<el-form-item prop="datetime1">
								<el-form-item prop="date1">
									<el-date-picker
										class="w_160i"
										v-model="ruleForm.date1"
										type="datetime"
										value-format="yyyy-MM-dd HH:mm:ss"
										format="yyyy-MM-dd HH:mm"
										placeholder="开始时间"
									>
									</el-date-picker>
								</el-form-item> </el-form-item
							>~
							<el-form-item prop="datetime2">
								<el-form-item prop="date2">
									<el-date-picker
										class="w_160i"
										v-model="ruleForm.date2"
										type="datetime"
										value-format="yyyy-MM-dd HH:mm:ss"
										format="yyyy-MM-dd HH:mm"
										placeholder="结束时间"
									>
									</el-date-picker>
								</el-form-item>
							</el-form-item>

							<el-button size="mini" type="primary" class="round-right" native-type="button" @click="shearchBtn"
								>搜索</el-button
							>
							<el-button size="mini" round @click="resetBtn">重置</el-button>
						</el-form>
					</el-col>
				</el-row>
			</div>
			<div class="tableMaxBox">
				<template>
					<!-- 表格部分 -->
					<el-table :data="demandList" stripe @selection-change="handleSelectionChange">
						<!--						<el-table-column type="selection" :selectable="checkboxT" disabled="true"> </el-table-column>-->
						<el-table-column type="selection" width="55"> </el-table-column>
						<el-table-column prop="task_sn" label="任务编号" width="150px">
							<template slot-scope="{ row }">
								<span class="pointer u text-primary" @click="goToMore(row)">{{ row.task_sn }}</span>
							</template>
						</el-table-column>
						<el-table-column prop="total" label="接单人" width="150px">
							<template slot-scope="{ row }">
								<div class="pointer u text-primary" @click="toPersonList(row)">
									<span>{{ row.staff_name }}</span>
									<span v-if="row.staff_name && row.staff_job_level">({{ row.staff_job_level | level2CN }})</span>
								</div>
							</template>
						</el-table-column>
						<el-table-column prop="mobile" label="手机号" width="100px"> </el-table-column>
						<el-table-column prop="shop_name" label="店铺名称" width="200">
							<template slot-scope="{ row }">
								<el-link type="primary" @click="goShopCont(row)">{{ row.shop_name }}</el-link>
							</template>
						</el-table-column>
						<el-table-column prop="start_date" label="任务开始/结束时间" width="170px">
							<template slot-scope="{ row }">
								<span>{{ row.start_date }}/{{ row.start_time }}-{{ row.end_time }}</span>
							</template>
						</el-table-column>
						<el-table-column prop="status" label="状态" width="80px" align="center">
							<template slot-scope="{ row }">
								<span class="text-success" v-if="row.status == '10'">待分配</span>
								<span class="text-primary" v-if="row.status == '15'">待下发</span>
								<span class="text-primary" v-if="row.status == '20'">已下发</span>
								<span class="text-gray" v-if="row.status == '30'">已确认</span>
								<span class="text-warning" v-if="row.status == '40'">已签到</span>
								<span class="text-warning" v-if="row.status == '50' || row.status == '80'">已完成</span>
								<span class="text-default" v-if="row.status == '60'">已撤回</span>
								<span class="text-danger" v-if="row.status == '70'">已取消</span>
							</template>
						</el-table-column>
						<el-table-column prop="label_name" label="岗位" width="110px" align="center">
							<template slot-scope="{ row }">
								<span>{{ row.job_name }}</span>
								<span v-if="row.job_level">({{ row.job_level | level2CN }})</span>
							</template>
						</el-table-column>
						<el-table-column prop="task_description" width="220px" label="任务备注"></el-table-column>
						<el-table-column prop="agent_name" label="代理商" width="120px"></el-table-column>
						<el-table-column prop="city_name" label="城市" align="center" width="80px"></el-table-column>
						<el-table-column prop="area_name" label="商圈"></el-table-column>
						<el-table-column prop="hour_expect" label="计划时长" min-width="50" align="center">
							<template slot-scope="{ row }">
								<span>{{ row.hour_expect }}h</span>
							</template>
						</el-table-column>
						<el-table-column prop="task_money" label="任务金额" min-width="50" align="center">
							<template slot-scope="{ row }">
								<span>{{ row.task_money }}</span>
							</template>
						</el-table-column>
						<el-table-column prop="pay_status" label="支付状态" min-width="80" align="center">
							<template slot-scope="{ row }">
								<span>{{ row.pay_status }}</span>
							</template>
						</el-table-column>
						<el-table-column prop="hour_actual" label="实际时长" min-width="50" align="center">
							<template slot-scope="{ row }">
								<span>{{ row.hour_actual }}h</span>
							</template>
						</el-table-column>
						<el-table-column prop="hour_diff" label="时长差(min)" min-width="90" align="center">
							<template slot-scope="{ row }">
								<span>{{ row.hour_diff }}min</span>
							</template>
						</el-table-column>
						<el-table-column prop="shop_change_hour" label="店铺调整时长" min-width="60" align="center">
							<template slot-scope="{ row }">
								<span>{{ row.shop_change_hour }}h</span>
							</template>
						</el-table-column>
						<el-table-column prop="staff_change_hour" label="人才调整时长" min-width="60" align="center">
							<template slot-scope="{ row }">
								<span>{{ row.staff_change_hour }}h</span>
							</template>
						</el-table-column>
						<el-table-column prop="shop_settlement_amount" width="100px" label="店铺结算金额"></el-table-column>
						<el-table-column label="店铺结算状态" width="100px">
							<template slot-scope="{ row }">
								<span class="text-waring" v-if="row.bill_shop_status == '0'">未入结算单</span>
								<span class="text-danger" v-if="row.bill_shop_status == '10'">已入结算单</span>
								<span class="text-default" v-if="row.bill_shop_status == '20'">待支付</span>
								<span class="text-success" v-if="row.bill_shop_status == '30'">已支付</span>
							</template>
						</el-table-column>
						<el-table-column prop="staff_settlement_amount" width="100px" label="人才结算金额"></el-table-column>
						<el-table-column label="人才结算状态" width="100px">
							<template slot-scope="{ row }">
								<span class="text-waring" v-if="row.bill_staff_status == '0'">未入结算单</span>
								<span class="text-danger" v-if="row.bill_staff_status == '10'">已入结算单</span>
								<span class="text-default" v-if="row.bill_staff_status == '20'">待提现</span>
								<span class="text-success" v-if="row.bill_staff_status == '30'">已提现</span>
							</template>
						</el-table-column>
						<!-- <el-table-column prop="sn" label="订单编号" width="150px">
							<template slot-scope="{ row }">
								<span class="pointer u text-primary" @click="goToMore(row)">{{ row.demand_sn }}</span>
							</template>
						</el-table-column> -->
						<el-table-column label="人才类型">
							<template slot-scope="{ row }">
								<span class="text-default" v-if="row.work_type == '1'">兼职</span>
								<span class="text-default" v-if="row.work_type == '2'">全职</span>
							</template>
						</el-table-column>
						<!-- <el-table-column prop="period" label="用工天数D"></el-table-column> -->
						<!-- <el-table-column prop="hour_actual" label="实际时长"></el-table-column> -->
						<el-table-column prop="add_time" label="创建时间" width="150px"></el-table-column>
						<el-table-column prop="accept_time" label="确认时间" width="150px"></el-table-column>
						<el-table-column prop="checkin_time" label="签到时间" width="150px"></el-table-column>
						<el-table-column prop="finish_time" label="完成时间" width="150px"></el-table-column>
						<el-table-column label="操作" width="90" fixed="right">
							<template slot-scope="{ row, $index }">
								<el-link
									:underline="false"
									type="danger"
									v-if="row.status != 50 && row.status != 70 && row.status != 80"
									@click="redactBtn(row, $index)"
								>
									取消
								</el-link>
								<el-link
									:underline="false"
									type="primary"
									v-if="row.status == 50 || row.status == 70 || row.status == 80"
									@click="adjustBill(row, $index)"
								>
									调账
								</el-link>
							</template>
						</el-table-column>
					</el-table>
					<!-- 分页组件 -->
					<page :total="total" :pageNums="pageNum" :disableMountedFetch="true" @pagedata="onChildValue"></page>
				</template>
			</div>
		</div>
		<!-- 任务取消 -->
		<el-dialog
			:title="diaTitle"
			:visible.sync="StateShowStop"
			width="560"
			:close-on-click-modal="false"
			@close="hiddenRY"
		>
			<div class="auditCentent">
				<div class="row-info clear">
					<div class="fl title-key"><i class="lhadmin"></i><span>责任方：</span></div>
					<div class="fl list-cont">
						<el-select v-model="cancel.zrf" placeholder="请选择">
							<el-option v-for="(item, index) in all_revoke.cancel" :key="index" :label="item.name" :value="index">{{
								item.name
							}}</el-option>
						</el-select>
					</div>
				</div>
				<div class="row-info clear">
					<div class="fl title-key"><i class="lhadmin"></i><span>类型：</span></div>
					<div class="fl list-cont">
						<el-select v-model="cancel.type" placeholder="请选择">
							<el-option v-for="(item, index) in cancel_type" :key="index" :label="item.name" :value="index">{{
								item.name
							}}</el-option>
						</el-select>
					</div>
				</div>
				<div class="row-info clear">
					<div class="fl title-key"><i class="lhadmin"></i><span>原因：</span></div>
					<div class="fl list-cont">
						<el-select v-model="cancel.reason" placeholder="请选择">
							<el-option v-for="item in cancel_reason" :key="item.id" :label="item.title" :value="item.id"></el-option>
						</el-select>
					</div>
				</div>
				<div class="row-info clear">
					<div class="fl title-key"><i class="lhadmin"></i><span>备注：</span></div>
					<div class="fl list-cont">
						<el-input type="textarea" :rows="8" :cols="44" placeholder="" v-model="cancel.bz"></el-input>
					</div>
				</div>
			</div>
			<div slot="footer" class="dialog-footer">
				<span class="btnOK mr_20" @click="addMenuBtn()">确 定</span>
				<span class="resetBtn" @click="hiddenRY">取 消</span>
			</div>
		</el-dialog>
		<!-- 创建调账记录-弹框 -->
		<el-dialog
			title="创建调账记录"
			:visible.sync="JobState"
			width="940px"
			:close-on-click-modal="false"
			:before-close="hiddenRY"
		>
			<div class="auditCentent tz">
				<div class="auditCentent_next">
					<div class="row-info clear">
						<div class="fl title-key">任务编号</div>
						<div class="fl list-cont bb">
							<el-input size="mini" disabled v-model="adjustment.task_sn"></el-input>
						</div>
					</div>
					<div class="row-info clear">
						<div class="fl title-key">店铺名称</div>
						<div class="fl list-cont bb">
							<el-input size="mini" disabled v-model="adjustment.dpmc"></el-input>
						</div>
					</div>
					<div class="row-info clear">
						<div class="fl title-key">商圈</div>
						<div class="fl list-cont bb">
							<el-input size="mini" disabled v-model="adjustment.sq"></el-input>
						</div>
					</div>
				</div>
				<div class="auditCentent_next">
					<div class="row-info clear">
						<div class="fl title-key">岗位</div>
						<div class="fl list-cont bb">
							<el-input size="mini" disabled v-model="adjustment.gw"></el-input>
						</div>
					</div>
					<div class="row-info clear">
						<div class="fl title-key">工作时间</div>
						<div class="fl list-cont bb">
							<el-input size="mini" disabled v-model="adjustment.gzsj"></el-input>
						</div>
					</div>
					<div class="row-info clear">
						<div class="fl title-key">单价</div>
						<div class="fl list-cont bb">
							<el-input size="mini" disabled v-model="adjustment.dj"></el-input>
						</div>
					</div>
				</div>
				<div class="auditCentent_next">
					<div class="row-info clear">
						<div class="fl title-key">接单人</div>
						<div class="fl list-cont bb">
							<el-input size="mini" disabled v-model="adjustment.jdr"></el-input>
						</div>
					</div>
					<div class="row-info clear">
						<div class="fl title-key">实际时长</div>
						<div class="fl list-cont bb">
							<el-input size="mini" disabled v-model="adjustment.sjsc"></el-input>
						</div>
					</div>
					<div class="row-info clear">
						<div class="fl title-key">费用</div>
						<div class="fl list-cont bb">
							<el-input size="mini" disabled v-model="adjustment.fy"></el-input>
						</div>
					</div>
				</div>
				<div class="auditCentent_next">
					<div class="row-info clear">
						<div class="fl title-key">签到时间</div>
						<div class="fl list-cont bb">
							<el-input size="mini" disabled v-model="adjustment.qdsj"></el-input>
						</div>
					</div>
					<div class="row-info clear">
						<div class="fl title-key">完成时间</div>
						<div class="fl list-cont bb">
							<el-input size="mini" disabled v-model="adjustment.wcsj"></el-input>
						</div>
					</div>
					<div class="row-info clear">
						<div class="fl title-key">状态</div>
						<div class="fl list-cont bb">
							<el-input size="mini" disabled v-model="adjustment.zt"></el-input>
						</div>
					</div>
				</div>
				<!-- 历史调账记录 -->
				<el-table :data="recordsList" style="width: 100%;">
					<el-table-column prop="adjust_type" label="调账对象" align="center">
						<template slot-scope="{ row }">
							<span class="text-success" v-if="row.adjust_type == 'staff'">人才</span>
							<span class="text-info" v-if="row.adjust_type == 'shop'">店铺</span>
						</template>
					</el-table-column>
					<el-table-column prop="adjust_hours" label="调整时长" align="center">
						<template slot-scope="{ row }">
							<span>{{ row.adjust_hours }}h</span>
						</template>
					</el-table-column>
					<el-table-column prop="amount_other" label="其他金额" align="center"> </el-table-column>
					<el-table-column prop="adjust_amount" label="合计金额" align="center"> </el-table-column>
					<el-table-column prop="remark" label="备注" align="center"> </el-table-column>
					<el-table-column prop="status" label="状态" width="80" align="center">
						<template slot-scope="{ row }">
							<span class="text-light" v-if="row.status == 10">未入结算单</span>
							<span class="text-primary" v-if="row.status == 20">已入结算单</span>
							<span class="text-danger" v-if="row.status == 30">已作废</span>
							<span class="text-info" v-if="row.status == 40 && row.adjust_type == 'shop'">待支付</span>
							<span class="text-success" v-if="row.status == 50 && row.adjust_type == 'shop'">已支付</span>
							<span class="text-info" v-if="row.status == 40 && row.adjust_type == 'staff'">待提现</span>
							<span class="text-success" v-if="row.status == 50 && row.adjust_type == 'staff'">已提现</span>
							<span class="text-danger" v-if="row.status == 60">已退款</span>
						</template>
					</el-table-column>
					<el-table-column prop="adder" label="创建人" align="center"> </el-table-column>
					<el-table-column prop="add_time" label="创建时间" align="center" width="160"> </el-table-column>
				</el-table>
				<el-divider>对店铺{{ ' ' + adjustment.dj }}</el-divider>
				<div class="auditCentent_next">
					<div class="row-info clear">
						<div class="fl title-key">时长</div>
						<div class="fl list-cont shichang">
							<el-select v-model="adjustment.sc">
								<el-option label="加" value="1"></el-option>
								<el-option label="减" value="2"></el-option>
							</el-select>
							<el-input size="mini" v-model="adjustment.sc_next" />
							<!--              onKeyPress="if((event.keyCode<48 || event.keyCode>57) && event.keyCode!=46 || /\.\d\d$/.test(value)) event.returnValue=false"-->
							<div style="margin: 0 22px 0 0;">h</div>
						</div>
					</div>
					<div class="row-info clear">
						<div class="fl title-key">时长金额</div>
						<div class="fl list-cont shichang_next">
							<el-input size="mini" v-model="adjustment.scje" disabled></el-input>
							<div style="margin: 0 22px 0 0;">元</div>
						</div>
					</div>
				</div>
				<div class="auditCentent_next">
					<div class="row-info clear">
						<div class="fl title-key">其他金额</div>
						<div class="fl list-cont shichang">
							<el-select v-model="adjustment.qtje">
								<el-option label="加" value="1"></el-option>
								<el-option label="减" value="2"></el-option>
							</el-select>
							<el-input size="mini" v-model="adjustment.qtje_next"></el-input>
							<div style="margin: 0 16px 0 0;">元</div>
						</div>
					</div>
					<div class="row-info clear">
						<div class="fl title-key">合计金额</div>
						<div class="fl list-cont shichang_next">
							<el-input size="mini" v-model="adjustment.hjje" disabled></el-input>
							<div style="margin: 0 22px 0 0;">元</div>
						</div>
					</div>
				</div>
				<div class="auditCentent_next">
					<div class="row-info clear">
						<div class="fl title-key"><i class="lhadmin lhadmin-wujiaoxing"></i>备注</div>
						<div class="fl list-cont shichang">
							<el-input type="textarea" :rows="8" :cols="44" placeholder="请填写" v-model="adjustment.bz"></el-input>
						</div>
					</div>
				</div>
				<el-divider>对人才{{ ' ' + adjustment.personnel_dj }}</el-divider>
				<div class="auditCentent_next">
					<div class="row-info clear">
						<div class="fl title-key">时长</div>
						<div class="fl list-cont shichang">
							<el-select v-model="adjustment.personnel_sc">
								<el-option label="加" value="1"></el-option>
								<el-option label="减" value="2"></el-option>
							</el-select>
							<el-input size="mini" v-model="adjustment.personnel_sc_next" />
							<!--              onKeyPress="if((event.keyCode<48 || event.keyCode>57) && event.keyCode!=46 || /\.\d\d$/.test(value))event.returnValue=false"-->
							<div style="margin: 0 22px 0 0;">h</div>
						</div>
					</div>
					<div class="row-info clear">
						<div class="fl title-key">时长金额</div>
						<div class="fl list-cont shichang_next">
							<el-input size="mini" v-model="adjustment.personnel_scje" disabled></el-input>
							<div style="margin: 0 22px 0 0;">元</div>
						</div>
					</div>
				</div>
				<div class="auditCentent_next">
					<div class="row-info clear">
						<div class="fl title-key">其他金额</div>
						<div class="fl list-cont shichang">
							<el-select v-model="adjustment.personnel_qtje">
								<el-option label="加" value="1"></el-option>
								<el-option label="减" value="2"></el-option>
							</el-select>
							<el-input size="mini" v-model="adjustment.personnel_qtje_next"></el-input>
							<div style="margin: 0 16px 0 0;">元</div>
						</div>
					</div>
					<div class="row-info clear">
						<div class="fl title-key">合计金额</div>
						<div class="fl list-cont shichang_next">
							<el-input size="mini" v-model="adjustment.personnel_hjje" disabled></el-input>
							<div style="margin: 0 22px 0 0;">元</div>
						</div>
					</div>
				</div>
				<div class="auditCentent_next">
					<div class="row-info clear">
						<div class="fl title-key"><i class="lhadmin lhadmin-wujiaoxing"></i>备注</div>
						<div class="fl list-cont shichang">
							<el-input
								type="textarea"
								:rows="8"
								:cols="44"
								placeholder="请填写"
								v-model="adjustment.personnel_bz"
							></el-input>
						</div>
					</div>
				</div>
			</div>
			<div slot="footer" class="dialog-footer">
				<span class="btnOK mr_20" @click="ticketMesaudit()">保 存</span>
				<span class="resetBtn" @click="hiddenRY()">关 闭</span>
			</div>
		</el-dialog>
		<!-- 该任务已有调账记录，确认还要创建吗? -->
		<el-dialog title="创建提示" :visible.sync="AssignmentTips" width="560px" :close-on-click-modal="false">
			<div class="auditCentent">
				<span>该任务已有调账记录，确认还要创建吗?</span>
			</div>
			<div slot="footer" class="dialog-footer">
				<span class="btnOK mr_20" @click="ticketMesaudit(2)">确 定</span>
				<span class="resetBtn" @click="AssignmentTips = false">取 消</span>
			</div>
		</el-dialog>
	</div>
</template>

<script>
const LIMIT_COUNT = 5000
import { billCreate, billList } from '@/api/bill'
import { taskList, taskInfo, fetchReasonList, taskCancel } from '@/api/task.js'
import { fetchLabelList, fetchAreaList, fetchShopList } from '@/api/shop.js'
import { fetchIndustryJob } from '@/api/label.js'
import axios from 'axios'
var common = require('../../../static/tool.js')
export default {
	name: 'TaskList',
	data() {
		return {
			id: '',
			dataMes: '',
			ids: '',
			ids_name: '',
			agreement: '',
			index: '',
			manageInfo: JSON.parse(sessionStorage.getItem('manageInfo')), //登录信息
			url: common.url,
			head_url: common.head_url,
			StateShowStop: false,
			JobState: false,
			AssignmentTips: false,
			bill_type: 1,
			diaTitle: '', //弹框title
			sn: '', //取消任务编号
			multipleSelection: [], //取消任务编号-多选选中的
			//搜索对应值
			task_sn: '', //任务编号
			demand_sn: '', //订单编号
			staff_name: '', //接单人
			mobile: '', //手机号
			cityList: [], // 城市列表
			city_val: '',
			flow_path: '1',
			city_id: '',
			area_arr: '', //商圈信息
			area_id: '',
			area_name: '',
			type_arr: '', //需求信息
			label_id: '',
			label_name: '',
			shop_id: '', //店铺id
			shop_name: '', //店铺名
			status: ['10', '15', '20', '30', '50', '40', '60', '70'],
			time_type: '2', //时间类型选择
			agent_id: '',
			ruleForm: {
				date1: '', //开始时间
				date2: '' //结束时间
			},
			work_type: '', //人才类型

			TypeArr: [],
			demandList: [], //任务列表
			//向分页组件传值
			total: 0,
			pageNum: 1,
			pageSizeNow: 20,
			// 审核状态
			text: '',
			areaList: [], //区域列表
			shopList: [], //店铺列表
			all_revoke: [],
			//取消相关
			cancel: {
				zrf: '',
				type: '',
				reason: '',
				bz: ''
			},
			cancel_type: [], //取消类型列表
			cancel_reason: [], //取消原因列表
			//历史调账记录
			recordsList: [],

			//创建调账记录的值
			adjustment: {
				adjustment_sn: '', //调账记录编号
				task_sn: '', //任务编号
				dpmc: '', //店铺名称
				sq: '', //商圈
				gw: '', //岗位
				gzsj: '', //工作时间
				dj: '', //店铺单价
				personnel_dj: '', //人才单价
				jdr: '', //接单人
				sjsc: '', //实际时长
				fy: '', //费用
				qdsj: '', //签到时间
				wcsj: '', //完成时间
				zt: '', //状态
				//对店铺
				sc: '1', //时长
				sc_next: '0',
				scje: '0', //时长金额
				qtje: '1', //其他金额
				qtje_next: '0',
				hjje: '0', //合计金额
				bz: '', //备注
				//对人才
				personnel_sc: '1', //时长
				personnel_sc_next: '0',
				personnel_scje: '0', //时长金额
				personnel_qtje: '1', //其他金额
				personnel_qtje_next: '0',
				personnel_hjje: '0', //合计金额
				personnel_bz: '', //备注
				is_prepay: '', //支付方式
				invoice_status: '' //开票状态
			},
			pay_status: '',
			is_prepay: '',
			shop_settlement_status: '',
			staff_settlement_status: '',
			areaStatus: true,
			agent_reset: 0,
			optionProps: {
				value: 'id',
				label: 'label_name'
			}
		}
	},
	computed: {
		shop_settlement() {
			return this.shop_settlement_status
		},
		staff_settlement() {
			return this.staff_settlement_status
		},
		//取消相关
		cancels_zrf() {
			return this.cancel.zrf.toString()
		},
		//取消相关
		cancels_type() {
			return this.cancel.type.toString()
		},
		//===对店铺===
		//时长金额计算
		scje() {
			const dj = this.adjustment.dj.substring(0, this.adjustment.dj.length - 4)

			if (this.adjustment.sc == 1) {
				return this.withhold2Pointer(this.adjustment.sc_next * dj)
			}

			return this.withhold2Pointer(this.adjustment.sc_next * dj * -1)
		},
		//合计金额计算
		hjje() {
			if (this.adjustment.qtje == 1) {
				return this.withhold2Pointer(this.adjustment.qtje_next * 1 + this.adjustment.scje * 1)
			}

			return this.withhold2Pointer(this.adjustment.qtje_next * -1 + this.adjustment.scje * 1)
		},

		//===对人才===
		//时长金额计算
		personnel_scje() {
			const dj = this.adjustment.personnel_dj.substring(0, this.adjustment.personnel_dj.length - 4)

			if (this.adjustment.personnel_sc == 1) {
				return this.withhold2Pointer(this.adjustment.personnel_sc_next * dj)
			}

			return this.withhold2Pointer(this.adjustment.personnel_sc_next * dj * -1)
		},
		//合计金额计算
		personnel_hjje() {
			if (this.adjustment.personnel_qtje == 1) {
				return this.withhold2Pointer(this.adjustment.personnel_qtje_next * 1 + this.adjustment.personnel_scje * 1)
			}

			return this.withhold2Pointer(this.adjustment.personnel_qtje_next * -1 + this.adjustment.personnel_scje * 1)
		},
		city_value() {
			return this.city_val
		}
	},
	watch: {
		//取消-责任方改变
		cancels_zrf(newValue, oldValue) {
			console.log('===', newValue)
			if (newValue != '') {
				this.cancel.type = '' //类型清空
				this.cancel.reason = '' //原因清空
				this.cancel_type = [] //取消类型列表清空
				this.cancel_reason = [] //取消原因列表清空
				this.cancel_type = this.all_revoke.cancel[newValue].child
			} else {
				this.cancel.type = '' //类型清空
				this.cancel.reason = '' //原因清空
				this.cancel_type = [] //取消类型列表清空
				this.cancel_reason = [] //取消原因列表清空
				this.cancel_type = []
			}
		},
		//取消-类型改变
		cancels_type(newValue, oldValue) {
			console.log('===', newValue)
			if (newValue != '') {
				this.cancel.reason = '' //原因清空
				this.cancel_reason = this.cancel_type[newValue].child
			} else {
				this.cancel.reason = '' //原因清空
				this.cancel_reason = []
			}
		},
		//===对店铺===
		scje(newValue, oldValue) {
			if (!isNaN(newValue)) {
				this.adjustment.scje = newValue
			} else {
				this.adjustment.scje = 0
			}
		},
		hjje(newValue, oldValue) {
			if (!isNaN(newValue)) {
				this.adjustment.hjje = newValue
			} else {
				this.adjustment.hjje = 0
			}
		},
		//===对人才===
		personnel_scje(newValue, oldValue) {
			if (!isNaN(newValue)) {
				this.adjustment.personnel_scje = newValue
			} else {
				this.adjustment.personnel_scje = 0
			}
		},
		personnel_hjje(newValue, oldValue) {
			if (!isNaN(newValue)) {
				this.adjustment.personnel_hjje = newValue
			} else {
				this.adjustment.personnel_hjje = 0
			}
		},
		//商圈改变
		areaList(newValue, oldValue) {
			this.listShop()
		}
		// city_value(newVal, oldVal) {
		// console.log('newVal', newVal)
		// if (oldVal) {
		// 	let [id, name] = oldVal.split('|')
		// 	if (id === '北京') {
		// 		id = 1
		// 	}
		// 	// 存储旧的商圈数据
		// 	this.selectedAreasMap[`city-${id}`] = this.area_arr
		// }
		// console.log('存储值', this.selectedAreasMap)
		// 	if (newVal && this.city_id) {
		// 		this.listArea(this.city_id) //商圈列表
		// 		this.listUser() //店铺列表
		// 	}
		// }
	},
	created() {
		this.selectedAreasMap = {}
		if (this.$route.query.id) {
			this.id = this.$route.query.id //接收传参
			this.business_id = this.id
		}
		if (this.$route.query.rl_sn) {
			this.demand_sn = this.$route.query.rl_sn //接收传参
		}
		if (this.$route.query.name) {
			this.staff_name = this.$route.query.name //接收传参
		}
		if (this.$route.query.shop_id && this.$route.query.shop_name) {
			this.shop_id = this.$route.query.shop_id
			this.shop_name = this.$route.query.shop_name
		}
		if (!sessionStorage.getItem('manageInfo')) {
			// 判断是否登录
			window.location = 'login.html'
			return
		}
		if (this.$route.query.task_sn) {
			this.task_sn = this.$route.query.task_sn
		}
		if (this.$route.query.start) {
			this.ruleForm.date1 = this.$route.query.start
			this.ruleForm.date2 = this.$route.query.end
		} else {
			//时间的默认选中
			var d = this.date(0)
			this.ruleForm.date1 = d + ' 00:00:00'
			var e = this.date(3)
			this.ruleForm.date2 = e + ' 23:59:00'
		}
		// 异常的账单，点击查看，跳转任务列表
		if (this.$route.query.bill_status) {
			this.task_sn = ''
			this.shop_settlement_status = ''
			this.staff_settlement_status = ''
			this.ruleForm.date1 = ''
			this.ruleForm.date2 = ''
		}

		//取消和撤销原因接口
		this.getResonList()
	},
	mounted() {
		//this.alljob_type()
	},
	methods: {
		setValue(data) {
			this.agent_id = data.agent_id

			// 清除店铺名称
			this.shop_id = this.$route.query.shop_id || ''
			this.shop_name = this.$route.query.shop_name || ''

			this.cityList = data.city_list
			if (this.cityList.length > 0) {
				// this.city_val = this.$route.query.city_name || this.cityList[0].name
				// this.city_id = this.$route.query.city_id || this.cityList[0].id
				this.city_val = this.cityList[0].name
				this.city_id = this.cityList[0].id
				this.listArea(this.city_id) //商圈列表
				this.listUser() //店铺列表
				this.alljob_type()
			}
		},
		date(e) {
			return this.$moment().add('days', e).format('YYYY-MM-DD')
		},
		// 监听城市val变化
		changeCity() {
			let [id, name] = this.city_val.split('|') // es6 数组解构赋值
			this.city_id = id
			this.city_name = name

			// 清除店铺名称
			this.shop_id = ''
			this.shop_name = ''
			this.listArea(this.city_id)
			this.listUser()
			this.alljob_type()
		},

		adjustBill(info) {
			this.JobState = true
			this.adjustment.task_sn = info.task_sn
			this.adjustment.is_prepay = info.is_prepay
			this.getTaskInfo()
		},

		// 任务取消和撤销原因接口
		async getResonList() {
			try {
				let ret = await fetchReasonList()
				this.all_revoke = ret
			} catch (err) {
				console.log('error:', err)
			}
		},

		// 获取任务详情
		async getTaskInfo() {
			try {
				let ret = await taskInfo({
					sn: this.adjustment.task_sn
				})
				this.adjustment.dpmc = ret.shop_name //店铺名称
				this.adjustment.sq = ret.area_name //商圈
				this.adjustment.gw = ret.job_name //岗位
				this.adjustment.gzsj = ret.start_time.substr(11, 5) + ' - ' + ret.end_time.substr(11, 5) //工作时间
				this.adjustment.dj = this.moneyUnitCent2Coin(ret.amout_shop) + '元/小时' //店铺单价
				this.adjustment.personnel_dj = this.moneyUnitCent2Coin(ret.amout_staff) + '元/小时' //人才单价
				this.adjustment.jdr = ret.staff_name //接单人
				this.adjustment.sjsc = ret.hour_actual + 'h' //实际时长
				this.adjustment.fy = this.moneyUnitCent2Coin(ret.total_shop) + '元' //费用
				this.adjustment.qdsj = ret.checkin_time //签到时间
				this.adjustment.wcsj = ret.finish_time //完成时间
				this.adjustment.zt = ret.status_name //状态
				this.adjustment.invoice_status = ret.invoice_status
				this.getAdjustmentList()
			} catch (err) {
				console.log('error:', err)
			}
		},
		// 创建调账单
		async ticketMesaudit(e) {
			if (!this.adjustment.task_sn) {
				this.$message.error('请填写任务编号！')
				return
			}

			// shop
			let shop_obj
			if (this.adjustment.hjje != 0 && this.adjustment.bz) {
				shop_obj = {
					adjust_hours: this.adjustment.sc == 1 ? this.adjustment.sc_next * 1 : this.adjustment.sc_next * -1, //调整时长
					amount_hours: this.adjustment.scje, //时长金额
					amount_other: this.adjustment.qtje == 1 ? this.adjustment.qtje_next * 1 : this.adjustment.qtje_next * -1, //其他金额
					adjust_amount: this.adjustment.hjje, //合计金额
					remark: this.adjustment.bz //备注
				}
			} else if (this.adjustment.hjje == 0 && !this.adjustment.bz) {
				shop_obj = {}
			} else {
				return this.$message.error('保存失败，必填项不可为空！')
			}

			// staff
			let staff_obj
			if (this.adjustment.personnel_hjje != 0 && this.adjustment.personnel_bz) {
				staff_obj = {
					adjust_hours:
						this.adjustment.personnel_sc == 1
							? this.adjustment.personnel_sc_next * 1
							: this.adjustment.personnel_sc_next * -1, //调整时长
					amount_hours: this.adjustment.personnel_scje, //时长金额
					amount_other:
						this.adjustment.personnel_qtje == 1
							? this.adjustment.personnel_qtje_next * 1
							: this.adjustment.personnel_qtje_next * -1, //其他金额
					adjust_amount: this.adjustment.personnel_hjje, //合计金额
					remark: this.adjustment.personnel_bz //备注
				}
			} else if (this.adjustment.personnel_hjje == 0 && !this.adjustment.personnel_bz) {
				staff_obj = {}
			} else {
				return this.$message.error('保存失败，必填项不可为空！')
			}

			if (
				this.adjustment.hjje == 0 &&
				!this.adjustment.bz &&
				this.adjustment.personnel_hjje == 0 &&
				!this.adjustment.personnel_bz
			) {
				return this.$message.error('保存失败，必填项不可为空！')
			}

			// 是否是预付&&已开票&&负的调账，
			let isPrepay = this.adjustment.is_prepay
			let invoice_status = this.adjustment.invoice_status
			// console.log(invoice_status, isPrepay, this.adjustment.hjje, this.adjustment.personnel_hjje)
			if (invoice_status == 50 && isPrepay == 1 && (this.adjustment.hjje < 0 || this.adjustment.personnel_hjje < 0)) {
				let ret = await this.$alert('该任务已开发票，不允许创建退款调账', '提示', {
					confirmButtonText: '确定'
				})
				if (ret === 'confirm') return
			}

			let adjust = {
				task_sn: this.adjustment.task_sn,
				shop: JSON.stringify(shop_obj),
				staff: JSON.stringify(staff_obj)
			}

			if (e == 2) {
				adjust = {
					...adjust,
					force: 1
				}
			} else {
				let ret = await this.$confirm('确定要创建此调账吗？', '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				})
				if (ret === 'cancel') return
			}

			try {
				let ret = await billCreate(adjust)
				// console.log(ret)
				if (+ret.code === 601) {
					//强制确认的弹框出现
					this.AssignmentTips = true
					return
				}
				this.$message.success('创建调账单成功！')
				this.hiddenRY()
				this.listShop()
			} catch (err) {}
		},
		// 调账账单列表
		async getAdjustmentList() {
			try {
				let ret = await billList({
					task_sn: this.adjustment.task_sn
				})
				if (ret.list) {
					this.recordsList = ret.list
				} else {
					this.recordsList = []
				}
			} catch (err) {
				console.log('error:', err)
			}
		},

		// 获取商铺列表
		async listUser() {
			try {
				let ret = await fetchShopList({
					sign_status: 30,
					city_id: this.city_id,
					agent_id: this.agent_id
				})
				if (ret.list) {
					ret.list.forEach(item => {
						item.value = item.name
					})
					this.shopList = ret.list
				} else {
					this.shopList = []
				}
			} catch (err) {
				console.log('error:', err)
			}
		},

		async listShop() {
			//判断时间框是否存在值
			// if (!this.ruleForm.date1 || !this.ruleForm.date2) {
			// 	this.$message.error('请选择任务开始时间及结束时间！')
			// 	return
			// }
			if (this.ruleForm.date1 == null) {
				this.ruleForm.date1 = ''
			}
			if (this.ruleForm.date2 == null) {
				this.ruleForm.date2 = ''
			}
			let task_sn, status
			if (this.$route.query.bill_status && this.bill_type == 1) {
				task_sn = this.$route.query.bill_task_sn
				// this.city_value = this.$route.query.city_id + '|' + this.$route.query.city_name
				// this.city_value = this.$route.query.city_name
				// this.listArea(this.$route.query.city_id)
			} else {
				task_sn = this.task_sn
			}

			if (this.status.includes('50')) {
				status = this.status.toString() + ',' + '80'
			} else {
				status = this.status.toString()
			}

			if (!this.shop_name) {
				this.shop_id = ''
			}

			let s_departmentIds_Arr = []
			this.area_arr.forEach(element => {
				let [id, name] = element.split('|') // es6 数组解构赋值
				s_departmentIds_Arr.push(id.toString())
			})

			try {
				let ret = await taskList({
					pageSize: this.pageSizeNow,
					page: this.pageNum,
					task_sn: task_sn,
					demand_sn: this.demand_sn,
					staff_name: this.staff_name,
					mobile: this.mobile,
					flow_path: this.flow_path,
					shop_id: this.shop_id,
					city_id: this.city_id,
					area_id: s_departmentIds_Arr.toString(),
					label_id: this.label_id,
					status: status,
					time_type: this.time_type,
					bill_staff_status: this.staff_settlement_status,
					bill_shop_status: this.shop_settlement_status,
					start_time: this.ruleForm.date1,
					end_time: this.ruleForm.date2,
					work_type: this.work_type,
					pay_status: this.pay_status,
					is_prepay: this.is_prepay,
					agent_id: this.agent_id
				})
				if (ret.list) {
					this.demandList = ret.list
					this.total = ret.count
				} else {
					this.demandList = []
					this.total = 0
				}
			} catch (err) {
				console.log('err:', err)
			}
		},

		shearchBtn() {
			// 搜索
			this.pageNum = 1
			this.bill_type = 2
			this.listShop()
		},

		//重置
		async resetBtn() {
			await this.resetData() //重置请求数据
		},

		async resetData() {
			//重置请求数据
			this.pageNum = 1
			this.task_sn = ''
			this.demand_sn = ''
			this.staff_name = ''
			this.mobile = ''
			this.flow_path = '1'
			this.type_arr = ''
			this.label_id = ''
			this.label_name = ''
			this.business_id = ''
			this.business_name = ''
			this.shop_id = ''
			this.shop_name = ''
			this.status = ['10', '15', '20', '30', '50', '40', '60', '70']
			this.time_type = 2
			//时间的默认选中
			var d = this.date(0)
			this.ruleForm.date1 = d + ' 00:00:00'
			var e = this.date(3)
			this.ruleForm.date2 = e + ' 23:59:00'
			this.shop_settlement_status = ''
			this.staff_settlement_status = ''
			this.work_type = ''
			this.pay_status = ''
			this.is_prepay = ''

			//重置代理商
			this.agent_reset += 1
		},

		//跳转任务详情
		goToMore(row) {
			const { href } = this.$router.resolve({
				path: '/roleMain',
				query: {
					rl_id: row.demand_id,
					rl_sn: row.demand_sn,
					task_id: row.id,
					task_sn: row.task_sn,
					start_date: row.start_date
				}
			})
			window.open(href, '_blank')
		},

		toPersonList(row) {
			const { href } = this.$router.resolve({
				path: '/personnelList',
				query: { name: row.staff_name }
			})
			window.open(href, '_blank')
		},

		//店铺的自动完成
		querySearch(queryString, cb) {
			var restaurants = this.shopList
			var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants
			// 调用 callback 返回建议列表的数据
			cb(results)
		},
		createFilter(queryString) {
			return restaurant => {
				return restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0
			}
		},
		handleSelect(item) {
			// console.log(item);
			this.shop_id = item.id
		},

		// 跳转店铺详情
		goShopCont(row) {
			const { href } = this.$router.resolve({ path: '/shopTag', query: { id: row.shop_id } })
			window.open(href, '_blank')
		},

		//分页组件->子组件传值
		onChildValue(item) {
			this.pageNum = item[0]
			this.pageSizeNow = item[1]
			this.listShop()
		},

		//导出
		async downloadOrder() {
			this.pageNum = 1
			if (!this.ruleForm.date1 || !this.ruleForm.date2) {
				this.$message.error('请选择任务开始和结束时间')
				return
			}

			let task_sn, status
			if (this.$route.query.bill_status && this.bill_type == 1) {
				task_sn = this.$route.query.bill_task_sn
			} else {
				task_sn = this.task_sn
			}
			let s_departmentIds_Arr = new Array()
			this.area_arr.forEach(element => {
				let [id, name] = element.split('|') // es6 数组解构赋值
				s_departmentIds_Arr.push(id)
			})
			if (this.status.includes('50')) {
				status = this.status.toString() + ',' + '80'
			} else {
				status = this.status.toString()
			}
			try {
				let fromData = {
					pageSize: this.pageSizeNow,
					page: this.pageNum,
					task_sn: task_sn,
					demand_sn: this.demand_sn,
					staff_name: this.staff_name,
					mobile: this.mobile,
					flow_path: this.flow_path,
					shop_id: this.shop_id,
					area_id: s_departmentIds_Arr.join(','),
					label_id: this.label_id,
					city_id: this.city_id,
					status: status,
					time_type: this.time_type,
					bill_staff_status: this.staff_settlement_status,
					bill_shop_status: this.shop_settlement_status,
					start_time: this.ruleForm.date1,
					end_time: this.ruleForm.date2,
					work_type: this.work_type,
					pay_status: this.pay_status,
					is_prepay: this.is_prepay,
					agent_id: this.agent_id
				}

				let ret = await taskList({ ...fromData })

				if (ret.list) {
					// this.demandList = ret.list
					this.total = ret.count
					if (this.total <= LIMIT_COUNT) {
						let obj = {
							token: JSON.parse(sessionStorage.getItem('manageInfo')).token,
							...fromData
						}
						delete obj.page
						delete obj.pageSize
						for (var key in obj) {
							if (!obj[key]) delete obj[key]
						}

						// var that = this
						// axios
						// 	.get(this.url + '/task/exportList', {
						// 		params: obj
						// 	})
						// 	.then(function (response) {
						// 		that.$alert('已添加下载任务，请到下载管理中查看', '', {
						// 			confirmButtonText: '确定'
						// 		})
						// 	})
						// 	.catch(function (error) {
						// 		alert(error)
						// 	})
						let param = $.param(obj)
						window.location.href = this.url + '/task/exportList?' + param
					} else {
						this.$message.error('当前条数已超过' + LIMIT_COUNT + '条，请修改查询条件后导出')
					}
				} else {
					this.demandList = []
					this.total = 0
				}
			} catch (error) {
				console.log('error:', error)
			}
		},
		changeBtndialogtype() {
			this.label_id = this.type_arr[1]
		},
		//标签接口
		async alljob_type() {
			this.type_arr = ''
			try {
				let ret = await fetchIndustryJob({
					city_id: this.city_id
				})
				if (ret.length > 0) {
					this.TypeArr = ret
				} else {
					this.TypeArr = []
				}
			} catch (err) {
				console.log(err)
			}
		},
		changeBtndialogarea() {
			console.log(this.area_arr)
			let [id, name] = this.area_arr.split('|').toString() // es6 数组解构赋值
			this.area_id = id.toString()
			this.area_name = name.toString()
		},
		//获取商圈列表
		async listArea(city_id) {
			try {
				this.area_arr = []
				let ret = await fetchAreaList({
					city_id: city_id,
					agent_id: this.agent_id
				})
				if (ret.list) {
					ret.list.forEach(item => {
						item.value = item.area_name
					})
					this.areaList = ret.list
					// if (this.area_arr == '' || this.area_arr == null) {
					// 	// 默认选中华成商圈
					// 	this.areaList.forEach(element => {
					// 		if (element.id != 0) {
					// 			var pusharr = element.id + '|' + element.area_name
					// 			this.area_arr.push(pusharr)
					// 		}
					// 	})
					// }
				} else {
					this.areaList = []
				}
			} catch (err) {
				console.log('error:', err)
			}
		},
		//取消
		redactBtn(e, index) {
			// console.log(e);
			this.sn = e.task_sn
			this.StateShowStop = true //状态关闭
			this.diaTitle = '取消任务'
		},
		//隐藏所有的弹框
		hiddenRY() {
			this.StateShowStop = false
			this.JobState = false
			this.AssignmentTips = false
			this.recordsList = []

			this.cancel.zrf = '' //责任方清空
			this.cancel.type = '' //类型清空
			this.cancel.reason = '' //原因清空
			this.cancel.bz = '' //备注清空
			this.cancel_type = [] //取消类型列表清空
			this.cancel_reason = [] //取消原因列表清空

			this.adjustment = {
				adjustment_sn: '', //调账记录编号
				task_sn: '', //任务编号
				dpmc: '', //店铺名称
				sq: '', //商圈
				gw: '', //岗位
				gzsj: '', //工作时间
				dj: '', //店铺单价
				personnel_dj: '', //人才单价
				jdr: '', //接单人
				sjsc: '', //实际时长
				fy: '', //费用
				qdsj: '', //签到时间
				wcsj: '', //完成时间
				zt: '', //状态
				sc: '1', //时长
				sc_next: '0',
				scje: '0', //时长金额
				qtje: '1', //其他金额
				qtje_next: '0',
				hjje: '0', //合计金额
				bz: '', //备注
				personnel_sc: '1', //时长
				personnel_sc_next: '0',
				personnel_scje: '0', //时长金额
				personnel_qtje: '1', //其他金额
				personnel_qtje_next: '0',
				personnel_hjje: '0', //合计金额
				personnel_bz: '', //备注
				invoice_status: '' //发票状态
			}
		},

		// 任务取消-弹框确认
		async addMenuBtn() {
			try {
				let ret = await taskCancel({
					sn: this.sn,
					reason_id: this.cancel.reason, // 取消原因id
					remark: this.cancel.bz // 取消备注
				})
				this.$message.success('操作成功')
				this.hiddenRY()
				setTimeout(() => {
					this.listShop()
				}, 1000)
			} catch (err) {
				console.log('error:', err)
			}
		},
		//多行的任务取消
		addMenuBtnQYALL() {
			console.log(this.multipleSelection)
			if (this.multipleSelection.length == 0) {
				this.$message.error('请选择相关任务！')
				return
			}

			this.sn = this.multipleSelection.toString()
			this.StateShowStop = true //状态关闭
			this.diaTitle = '取消任务'
		},
		//获取选中行的id
		handleSelectionChange(val) {
			//获取用户的选中
			this.multipleSelection = []
			val.forEach(item => {
				this.multipleSelection.push(item.task_sn)
			})
			this.multipleSelection = Array.from(new Set(this.multipleSelection))
		},
		//设置表格复选框禁用
		checkboxT(row, index) {
			if (row.status == '50' || row.status == '70') {
				return false
			} else {
				return true
			}
		},
		//全选-取消全选商圈
		selectAllArea() {
			let arr = []
			this.areaList.forEach(item => {
				arr.push(`${item.id}|${item.area_name}`)
			})
			if (this.areaStatus == true) {
				this.area_arr = arr
			} else {
				this.area_arr = []
			}
			this.areaStatus = !this.areaStatus
			// this.shearchBtn()
		}
	},
	filters: {
		ReversalTime: function (value) {
			value = value % 24
			return common.getReversalTime(value)
		}
	}
}
</script>

<style scoped>
/* .search_box{width:790px;} */
.auditCentent .labels {
	min-height: 100px;
}
.auditCentent .labels .labels_label {
	float: left;
	cursor: pointer;
}
.check_label {
	background: var(--purple4);
	color: #fff;
	border: none;
}
.pdf {
	width: 860px;
	height: 600px;
}
.main_user {
	background: var(--zfy-red);
	color: #fff;
	text-decoration: none;
	padding: 2px 4px;
	border-radius: 4px;
}
@media (max-width: 767.78px) {
	.titleBox {
		height: 40px;
	}
}
.auditCentent_next {
	display: flex;
	margin-bottom: 10px;
}

.timeline {
	height: 30px;
	line-height: 30px;
	margin-bottom: 20px;
}

.timeline span {
	margin-left: 10px;
}
</style>
<style>
.tableMaxBox .el-table th .el-checkbox__input {
	display: block;
}
.reset-el-select-tags .el-select__tags {
	max-width: 146px !important;
}
.mt {
	margin-top: -4px;
}
</style>



// WEBPACK FOOTER //
// src/components/taskList/List.vue